package com.artwork.service.impl;

import com.artwork.mapper.TicketMapper;
import com.artwork.model.Ticket;
import com.artwork.service.TicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author JoJo
 * @Data 2021/9/9$ 15:02$
 * @Description
 * @Param $
 * @Return $
 */
@Service
public class TicketServiceImpl implements TicketService {
    @Autowired
    TicketMapper ticketMapper;

    @Override
    public List<Ticket> getList() {
        return ticketMapper.getList();
    }

    @Override
    public List<Ticket> getUserList(int userId) {
        return ticketMapper.getUserList(userId);
    }

    @Override
    public int addTicket(Ticket ticket) {
        return ticketMapper.insertSelective(ticket);
    }

    @Override
    public int updateTicket(Ticket ticket) {
        return ticketMapper.updateByPrimaryKeySelective(ticket);
    }

    @Override
    public Ticket getTicket(int id) {
        return ticketMapper.selectByPrimaryKey(id);
    }

    @Override
    public int deleteticket(int id) {
        return ticketMapper.deleteTicket(id);
    }
}
